import logging
import os
import pathlib

def setup_status_logger():
    """配置状态日志记录器"""
    log_folder = os.path.join(str(pathlib.Path(__file__).parent.resolve()), "logs")
    if not os.path.exists(log_folder):
        os.makedirs(log_folder)
    
    # 创建状态日志处理器
    status_log = logging.FileHandler(os.path.join(log_folder, "status_monitor.log"), encoding='utf-8')
    status_log.setLevel(logging.INFO)
    
    # 设置日志格式
    formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
    status_log.setFormatter(formatter)
    
    # 创建并配置logger
    status_logger = logging.getLogger('status')
    status_logger.addHandler(status_log)
    
    return status_logger